//
//  packet.h
//  reli_udp
//
//  Created by Eric Sun on 11/20/12.
//  Copyright (c) 2012 Eric Sun. All rights reserved.
//

#include <stdlib.h>
#define PACKET_SIZE 1024 // packet size in byte.
#define HEADER_SIZE 24  //header size in byte.
#define PAYLOAD 1000

struct Packet
{
    unsigned int seq;
    unsigned int ack;
    char flagAck;	//indicate packet is ack packet or not.
    char flagReq;
    char flagEnd;
    char flagFin;
    size_t len;
    char unused[8];
    char data[PAYLOAD];
};

struct Window
{
    struct Packet packet;
    struct timeval tv;
    char used;
};